#ifndef _RECO_PROXY_H_
#define _RECO_PROXY_H_
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
#include<memory>
#include "../../api/api.h"
//#include"../data/data.h"
//#include "../buffer/buffer.h"
//#include"../vad/vadInst.h"
#include"../utils/log/recoProxyLog.h"
#include"../reporter/reporter.h"
#include "../options/options.h"
#include"iflytekAsrInst.h"
#include "../vad/recoProxy_vad.h"

using namespace std;
using namespace speech;
//typedef shared_ptr<data>    sData;
//typedef shared_ptr< buffer<sData> >      sVadBuffer;
//typedef shared_ptr< vadInst >            sVadInst;
typedef shared_ptr<iflytekAsrInst> sIflytekAsrInst;
//typedef shared_ptr<speech::reporter> sReporter;

class recoProxy
{
public:

	recoProxy(const char* pUuid, int iUuidLen,void* pCbObj, vadOptions* pVadOptions, asrOptions* pAsrOptions, getResCb pCbFunc);
		//:_pCbObj(pCbObj),

	void feedData(char* pData, int iLen);
	void close();
	void processVadRes( unsigned char * pData, int iLen, vadVars* pVars);
	void updateTime(int iType, int iTime);
	void processVadClose()
	{
		_pAsrInst->close();
		if(_curFp)
		{
			_pAsrInst->sendMsg(FRAME_LAST,NULL,0);
			fclose(_curFp);
		}
	}
	~recoProxy()
	{
		releaseVadCbUtil(_pCbUtil);
	}
private:
	vadOptions* getOptions() { return &_pVadOptions;}
	void outputDbgFile(void* pContent, int iLen);
	void closeDbgFile();
	void openDbgFile(int iIndex);
	sReporter getReporter() {return _sReporter;}
	//void*             _pCbObj;
	//int               _iRenderId;
	vadOptions        _pVadOptions;
	asrOptions        _pAsrOptions;
	//getResCb          _pCbFunc;
	//sVadBuffer        _pVadBuffer;
	void*             _pVadInst;
	sReporter         _sReporter;
	sIflytekAsrInst _pAsrInst;
	vadCbUtil*      _pCbUtil;
	FILE*           _curFp;
};
#endif
